<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>选课信息 - 学生成绩管理系统</title>
  <link rel="stylesheet" href="view/assets/css/bootstrap.min.css">
  <script src="view/assets/js/html5shiv.min.js"></script>
  <script src="view/assets/js/respond.min.js"></script>
</head>
<style>
  *{
    margin: 0;
    padding: 0;
  }
</style>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" style="margin: auto;" href="admin.php">学生成绩查询系统</a>
      <a class="navbar-brand" style="margin: auto;" href="course.php">课程信息</a>
      <a class="navbar-brand" style="margin: auto;" href="selectCourse.php">选课信息</a>
      <a class="navbar-brand" style="margin: auto;" href="scorelist.php">成绩统计</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <form class="navbar-form navbar-right">
        <a type="button" class="btn btn-success" href="logout.php">退出</a>
      </form>
    </div>
  </div>
</nav>
<!--头部-->
<div class="jumbotron text-center">
  <div style="margin: 20px;">
    <p>学生成绩查询系统</p><p>选课信息</p>
  </div>
</div>

<!--主体部分-->
<div class="container text-center">
  <?php foreach ($courses as $c ){ ?>
  <div class="panel panel-default">
    <div class="panel-heading"><?php echo $c['course_name'];?><p>该课程由 <span class="label label-primary"><?php echo $c['nick'];?></span> 老师授课</p></div>
    <span class="label label-info">共有<?php echo $c['stu_num'];?>人选了这门课</span>
    <div class="panel-body">
      <div class="table-responsive">
        <table class="table table-bordered tab-hover">
          <thead>
          <tr>
            <th>ID</th>
            <th>学号</th>
            <th>姓名</th>
            <th>班级</th>
          </tr>
          <tbody>
        <?php
            $num = 1;
            $coursename = $c['course_name'];
            $find="select course_name,nick,stunum,class from stu_course,course,users where stu_course.course_id = course.course_id and stu_course.stu_id = users.user_id and course_name = '{$coursename}'";
            $courseinfo = mGetAll($find);
            foreach ($courseinfo as $info){?>
          <tr>
            <td><?php echo $num; ?></td>
            <td><?php echo $info['stunum']; ?></td>
            <td><?php echo $info['nick'];?></td>
            <td><?php echo $info['class'];?></td>
          </tr>
          <?php $num = $num + 1;}?>
          </tbody>
        </table>
      </div>
    </div>
  </div>
  <?php }?>
</div>
<!--页尾-->
<div class="jumbotron text-center" style="margin-bottom:0">
  <p>Copyright © 2020-2021 学生成绩查询系统</p>
</div>
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
</body>
</html>
